Skip to content

Fix tasks not loading on .NET Framework #8952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 17, 2025
Merged

Fix tasks not loading on .NET Framework #8952

merged 3 commits into from
Apr 17, 2025

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Apr 16, 2025

... due to inconsistent TFMs. See #8864 (comment) for more details

Problem

Fixes loading templating tasks on .NET Framework due to inconsistent TFMs.

C:\Users\vihofer.nuget\packages\microsoft.templateengine.authoring.tasks\10.0.100-preview.4.25215.8\build\Microsoft.
TemplateEngine.Authoring.Tasks.targets(14,5): error MSB4018: The "LocalizeTemplates" task failed unexpectedly. [C:\temp
\templmsbuild\templmsbuild.csproj]
C:\Users\vihofer.nuget\packages\microsoft.templateengine.authoring.tasks\10.0.100-preview.4.25215.8\build\Microsoft.Te
mplateEngine.Authoring.Tasks.targets(14,5): error MSB4018: System.IO.FileNotFoundException->Microsoft.Build.Framework.B
uildException.GenericBuildTransferredException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstracti
ons, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot f
ind the file specified. [C:\temp\templmsbuild\templmsbuild.csproj]

Solution

For non samples, non test projects and non templates, change the following TFMs:

  • NetCurrent -> NetMinimum (net8.0)
  • NetFrameworkCurrent -> NetFrameworkMinimum (net472 for this repo)

Checks:

... due to inconsistent TFMs. See #8864 (comment) for more details
Copy link
Member

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change overall but looks like some of the code is now missing features from certain .NET versions (according to the build failures).

@ViktorHofer
Copy link
Member Author

Probably needs the ValueTuple package. Will fix tomorrow.

@ViktorHofer ViktorHofer merged commit af563de into main Apr 17, 2025
10 checks passed
@ViktorHofer ViktorHofer deleted the FixTemplatingTFMs branch April 17, 2025 07:49
@ViktorHofer
Copy link
Member Author

/backport to release/9.0.1xx

Copy link
Contributor

Started backporting to release/9.0.1xx: https://github.com/dotnet/templating/actions/runs/14510819787

Copy link
Contributor

@ViktorHofer backporting to "release/9.0.1xx" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix tasks not loading on .NET Framework
Using index info to reconstruct a base tree...
M	tools/Microsoft.TemplateEngine.Authoring.TemplateVerifier/Microsoft.TemplateEngine.Authoring.TemplateVerifier.csproj
M	tools/Microsoft.TemplateSearch.TemplateDiscovery/Microsoft.TemplateSearch.TemplateDiscovery.csproj
Falling back to patching base and 3-way merge...
Auto-merging tools/Microsoft.TemplateSearch.TemplateDiscovery/Microsoft.TemplateSearch.TemplateDiscovery.csproj
CONFLICT (content): Merge conflict in tools/Microsoft.TemplateSearch.TemplateDiscovery/Microsoft.TemplateSearch.TemplateDiscovery.csproj
Auto-merging tools/Microsoft.TemplateEngine.Authoring.TemplateVerifier/Microsoft.TemplateEngine.Authoring.TemplateVerifier.csproj
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix tasks not loading on .NET Framework
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

ViktorHofer added a commit that referenced this pull request Apr 17, 2025
* Fix tasks not loading on .NET Framework

... due to inconsistent TFMs. See #8864 (comment) for more details

* Fix TFMs and set NetFrameworkMinimum to net472

* Build NetCurrent in source-only builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants